/**
 * @function 歌词处理
 * @description	用于处理网易云音乐的歌词，将歌词转换为对象数组
 * @param {String} lyric 歌词
 * @returns {Array} 歌词数组
 */
export function parseLyric(lyric) {
    const lyricArr = lyric.split('\n')
    const lyricList = []
    lyricArr.forEach((item) => {
        const timeReg = /\[\d*:\d*((\.|:)\d*)*\]/g
        const timeRegExpArr = item.match(timeReg)
        if (!timeRegExpArr) return
        const content = item.replace(timeReg, '')
        timeRegExpArr.forEach((item) => {
        const t = item.slice(1, -1).split(':')
        const time = parseInt(t[0], 10) * 60 + parseFloat(t[1])
        lyricList.push({ time, content })
        })
    })
    return lyricList
}